/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:张熳
 * Date:2025-10-24
 * Time:23:52
 */
public class Test {
    public static void main(String[] args) {
        //用栈实现队列
        QueueByStack queue = new QueueByStack();
        //入队列
        queue.push(12);
        queue.push(23);
        queue.push(34);
        //出队列
        System.out.println(queue.pop());//12
        //获取对头元素
        System.out.println(queue.peek());//23
    }
    public static void main1(String[] args) {
        //用队列实现栈
        StackByQueue stack = new StackByQueue();
        //入栈
        stack.push(12);
        stack.push(23);
        stack.push(34);
        //出栈
        System.out.println(stack.pop());//34
        //获取栈顶元素
        System.out.println(stack.top());//23
    }
}
